package org.uturn.timeshift.web.menus;

import org.primefaces.model.menu.DefaultMenuModel;
import org.primefaces.model.menu.MenuModel;
import org.uturn.timeshift.utils.utils.XMLConverter;
import org.uturn.timeshift.web.menus.utils.MenuUtils;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;

/**
 * Created by przemyslaw.sudak on 2/26/2015.
 */
@ManagedBean(name = "leftMenu")
public class LeftMenuView {

    private MenuModel model;

    private MenuUtils utils = new MenuUtils();

    @PostConstruct
    public void init(){

        String page = utils.getXHTMLFilePageName();
        XMLConverter xmlConverter = new XMLConverter();
        switch(page){
            case "index" : model = new DefaultMenuModel();
                break;
            case "login" : model = utils.getMenu("login");
                break;
        }
    }

    public MenuModel getModel() {
        return model;
    }

    public void setModel(MenuModel model) {
        this.model = model;
    }
}
